{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from mpl_toolkits.mplot3d import Axes3D\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "df = pd.read_csv(\"app_stats.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Data Quality Report\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Data Type</th>\n",
       "      <th>Count</th>\n",
       "      <th>Unique Values</th>\n",
       "      <th>Missing Values</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>ts</th>\n",
       "      <td>float64</td>\n",
       "      <td>942</td>\n",
       "      <td>798</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ts_delta</th>\n",
       "      <td>float64</td>\n",
       "      <td>942</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>app</th>\n",
       "      <td>object</td>\n",
       "      <td>942</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>uniq_hosts</th>\n",
       "      <td>int64</td>\n",
       "      <td>942</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>hits</th>\n",
       "      <td>int64</td>\n",
       "      <td>942</td>\n",
       "      <td>47</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>bytes</th>\n",
       "      <td>int64</td>\n",
       "      <td>942</td>\n",
       "      <td>770</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           Data Type  Count Unique Values  Missing Values\n",
       "ts           float64    942           798               0\n",
       "ts_delta     float64    942             1               0\n",
       "app           object    942             3               0\n",
       "uniq_hosts     int64    942             1               0\n",
       "hits           int64    942            47               0\n",
       "bytes          int64    942           770               0"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#DataFrame with columns\n",
    "columns = pd.DataFrame(list(df.columns.values[1:]))\n",
    "\n",
    "#DataFrame with data types\n",
    "data_types = pd.DataFrame(df.dtypes, columns=['Data Type'])\n",
    "\n",
    "#DataFrame with Count\n",
    "data_count = pd.DataFrame(df.count(), columns=['Count'])\n",
    "\n",
    "#DataFrame with unique values\n",
    "unique_value_counts = pd.DataFrame(columns=['Unique Values'])\n",
    "for v in list(df.columns.values):\n",
    "    unique_value_counts.loc[v] = [df[v].nunique()]\n",
    "\n",
    "missing_data_counts = pd.DataFrame(df.isnull().sum(), columns=['Missing Values'])\n",
    "data_quality_report = data_types.join(data_count).join(unique_value_counts).join(missing_data_counts)\n",
    "print('Data Quality Report')\n",
    "data_quality_report"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
